/*
 * test_backtrace.cpp
 *
 *  Created on: Jan 17, 2014
 *      Author: killerg
 */

#include <execinfo.h>
#include <stdlib.h>
#include <stdio.h>
#include <functional>

int fun2() {
    void* buffer[100];
    int num = backtrace(buffer, 100);
    char** str = backtrace_symbols(buffer, num);

    for (int i=0; i<num; ++i) {
        printf("%s\n", str[i]);
    }
    free(str);
    return 2;
}

int fun1() {
    return fun2();
}

bool test_backtrace() {
    fun1();
    std::function<void(int)> haha;
    haha(1);
    return true;
}
